﻿using System.ServiceProcess;
using System;
using System.Linq;
using System.Threading;
using YEA.Utilities.Common;

namespace YEA.Monitor.LogService
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main(string[] args)
        {
            if( args.Any<string>( val => val.Equals("/install", StringComparison.OrdinalIgnoreCase)))
            {
                UtilitiesHelper.Install( typeof(Program), true);
                return;
            }
            if( args.Any<string>( val => val.Equals("/uninstall", StringComparison.OrdinalIgnoreCase)))
            {
                UtilitiesHelper.Install( typeof(Program), false);
                return;
            }
#if DEBUG
            var tm = new ServiceStateController();
            tm.Start();
#else


            ServiceBase[] ServicesToRun;
            ServicesToRun = new ServiceBase[] 
            { 
                new LogManagerService() 
            };
            ServiceBase.Run(ServicesToRun);
#endif
        }
    }
}
